﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace peta
{
    class Server
    {
        private static readonly Server instance = new Server();
        
        private List<Client> clienti = new List<Client>();

        private Server() { }
        public static Server getInstance() 
        { 
            return instance; 
        }
        public void addClient(Client client)
        {
            clienti.Add(client);
        }

        //afisare clienti
        public void afiseazaClienti()
        {
            if (clienti.Count == 0)
            {
                Console.WriteLine("Adaugati un client mai intai");
                return;
            }
            foreach (Client client in Server.getInstance().clienti)
            {
                client.showInfoClient();
            }
            Console.WriteLine();
        }

        public Client gasesteClient(String name)
        {
            foreach (Client client in Server.getInstance().clienti)
            {
                if (client.getNume() == name)
                {
                    return client;
                }

            }
            return null;
        }
    }
}
